home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / pisces / rcs / rcsdups.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-04  |  717 b   |  36 lines

  1. /**
  2.  ** Scan the command line for file name arguments and remove duplicates. This
  3.  ** is necessary because PISCES concatentates all SRCS definitions to produce
  4.  ** a list of files at revup time. Since the same file may be used in more than
  5.  ** one program in the Imake file, you can't revup the same file more than
  6.  ** once!
  7.  **/
  8.  
  9. #ifndef NULL
  10. #define NULL 0L;
  11. #endif
  12.  
  13. int remove_duplicates(argc, argv)
  14. int argc; char ** argv; 
  15. {
  16.     int i, j;
  17.     register char** p;
  18.     register char** q;
  19.  
  20.     for( i = 0, p = argv; i < argc; p++, i++)
  21.     {    
  22.     for( j = i, q = p+1; j < argc-1; q++, j++)
  23.     {
  24.         if( !strcmp (*p, *q) )
  25.         {
  26.         *q = argv[argc-1];
  27.         argv[argc-1] = NULL;
  28.         argc--;
  29.         }
  30.     }
  31.     }
  32.     return argc;
  33. }
  34.  
  35.  
  36.